/**
 * @Author：ming
 * @Date：2023/9/26 6:50 PM
 * @Filename：Lc26
 */

/**
 * @author ming
 */
public class Lc26 {
    public int removeDuplicates(int[] nums) {

       int count  =nums.length;

       int p = 0;
       int q =1;
       int len = nums.length;
       while (q<len){
           if(nums[p]==nums[q]){
               q++;
               count--;
           }else {
               p++;
               nums[p]=nums[q];
               q++;
           }

       }
        return count;
    }
}
